<style>
    .layui-input {
        width: 60% !important;
    }

    .layui-edge {
        right: 161px !important;
    }

    .layui-form-select dl {
        min-width: 60% !important;
    }

    .layui-form-label {
        width: 134px !important;
    }
</style>
<form id="categroy_edit" style="margin-top: 15px;" action="{{route('admin.category.update',['id'=>$data['id']])}}"
      class="layui-form">
    {{csrf_field()}}
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" id="name" name="data[name]" value="{{$data["name"]}}" autocomplete="off" placeholder="名称"
                   class="layui-input">
        </div>
    </div>
    @if($data["group_id"]==1)
        <div class="layui-form-item">
            <label class="layui-form-label">使用范围</label>
            <div class="layui-input-block">
                @if($father["scope_course"]==1)
                    <input type="checkbox" name="data[scope][]" class="parent" lay-skin="primary"
                           value="course" title="课程" @if($data["scope_course"]) checked @endif>
                @endif
                @if($father["scope_exam"]==1)
                    <input type="checkbox" name="data[scope][]" class="parent" lay-skin="primary"
                           value="exam" title="考试" @if($data["scope_exam"]) checked @endif>
                @endif

            </div>
        </div>
    @endif
    <div class="layui-form-item">
        <label class="layui-form-label">分组</label>
        <div class="layui-input-block">
            <select id="group_id" disabled lay-filter="search_type">
                <option @if(request("group_id")=="") selected @endif value="">--选择分组--</option>
                @foreach($group as $g)
                    <option @if($data["group_id"]==$g["id"]) selected
                            @endif value='{{$g["id"]}}'>{{$g["name"]}}</option>
                @endforeach
            </select>

            <input name="data[group_id]" value="{{$data["group_id"]}}" style="display: none;"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">父级</label>
        <div class="layui-input-block">
            <select id="parent_id" disabled>
                <option value="{{$father["id"]}}">--{{$father["name"]}}--</option>
            </select>

            <input name="data[parent_id]" value="{{$father['id']}}" style="display: none;"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <select id="status" name="data[status]">
                <option value="">--选择状态--</option>
                <option @if($data["status"]==0) selected @endif value='0'>禁用</option>
                <option @if($data["status"]==1) selected @endif value='0'>启用</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <textarea type="text" id="description" name="data[description]" placeholder="分类描述" style="height: 100px;"
                      class="layui-input">{{$data["description"]}}</textarea>
        </div>
    </div>
</form>

